package com.archtecture.model.patterns;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

import com.archtecture.model.exceptions.NegocioException;
import com.spgf.model.entities.utils.ModelAb;
import com.spgf.model.utils.AndroidUtil;

public abstract class PadraoActivity<Model extends ModelAb> extends Activity {

	protected void configurarManutencao() throws NegocioException {}

	protected void construirTela(Bundle savedInstanceState) throws NegocioException {}

	protected abstract PadraoRNAb<Model> getRN();;

	@Override
	protected final void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		try {
			construirTela(savedInstanceState);
			configurarManutencao();
		} catch (NegocioException e) {
			Toast.makeText(this, AndroidUtil.obterMensagemErro(e), Toast.LENGTH_SHORT).show();
		}
	}
}
